/*
 * $Id: inotify.h 520 2008-05-14 08:43:58Z jasta00 $
 *
 * Copyright (C) 2008 Josh Guilfoyle <jasta@devtcg.org>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

#ifndef __INOTIFY_H
#define __INOTIFY_H

/*****************************************************************************/

#ifdef SYS_INOTIFY_H_EXISTS_AND_WORKS
#include <sys/inotify.h>
#else /* !SYS_INOTIFY_H_EXISTS_AND_WORKS */
#include "inotify-nosys.h"
#endif /* SYS_INOTIFY_H_EXISTS_AND_WORKS */

/*****************************************************************************/

typedef gboolean (*MyInotifyCb) (const char *name, int wd,
  unsigned int mask, unsigned int cookie, gpointer udata);

GIOChannel *my_inotify_open(void);
void my_inotify_close(GIOChannel *gio);
int my_inotify_add_watch(GIOChannel *gio, const char *path);
int my_inotify_remove_watch(GIOChannel *gio, int wd);
void my_inotify_callback(GIOChannel *gio, MyInotifyCb cb, gpointer udata,
  GDestroyNotify notify);

typedef void (*WatchCreateDirCb) (const char *path);
typedef void (*WatchMoveCb) (const char *src, const char *dst);
typedef void (*WatchModifyCb) (const char *path);
typedef void (*WatchDeleteCb) (const char *path);

void my_inotify_wrapper(GIOChannel *gio, WatchCreateDirCb create_dir,
  WatchMoveCb move, WatchModifyCb modify, WatchDeleteCb delete);

/*****************************************************************************/

#endif /* __INOTIFY_H */
